aboutsummaryrefslogtreecommitdiff
path: root/examples/docs/src/pages/[...slug].astro
blob: a59e4bc2a80817a73f31f0f66e7d199dd3dd30ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
---
import { CollectionEntry, getCollection } from 'astro:content';
import MainLayout from '../layouts/MainLayout.astro';

export async function getStaticPaths() {
	const docs = await getCollection('docs');
	return docs.map((entry) => ({
		params: {
			slug: entry.slug,
		},
		props: entry,
	}));
}
type Props = CollectionEntry<'docs'>;

const post = Astro.props;
const { Content, headings } = await post.render();
---

<MainLayout headings={headings} {...post.data}>
	<Content />
</MainLayout>